package com.practice.bootdemo.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author :Administrator
 * @description: TODO edit class Description
 * @create date: 2021/10/29 18:25
 */
@RestController
@RequestMapping(value = "redisMsg")
@Api(value = "RedisMsgSendController", tags = {"测试redis消息发送"})
public class RedisMsgSendController {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @RequestMapping(value = "send", method = RequestMethod.GET)
    @ApiOperation(value = "发送测试信息", httpMethod = "GET")
    public void send(String name) {
        stringRedisTemplate.convertAndSend("redis_channel_one","hi,".concat(name));
    }

}
